<%--
  Created by IntelliJ IDEA.
  User: Admin
  Date: 2020/7/26
  Time: 16:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>影院票务管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/front/style/CSS/normalize.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/front/style/CSS/bangdan.css">
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/front/style/IMG/Blogo.png" type="image/x-icon">
</head>

<body>
<!-- 顶部 -->
<header class="dingbu">
    <nav>
        <a href="#" class="logo"></a>
        <ul class="navbar">
            <li>
                <a href="${pageContext.request.contextPath}/front/index.jsp">首页</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/front/movie.jsp">电影</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/front/filmRank.jsp">排行榜</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/front/screening.jsp">场次安排</a>
            </li>
            <li>
                <a href="#">会员卡</a>
            </li>
            <li>
                <a href="${pageContext.request.contextPath}/front/userOrders.jsp">个人信息</a>
            </li>
        </ul>

        <div class="sousuo">
        </div>
        <div class="denglu bian">
            <a href="#">
                <img src="${pageContext.request.contextPath}/front/style/IMG/avatar.png" alt="">
            </a>
            <span class="sanjiao"></span>
            <div>
                <a id="showStatus" href="${pageContext.request.contextPath}/front/accountLogin.jsp">登录</a>
            </div>
        </div>
    </nav>
</header>
<!-- 榜单 -->
<div class="header">
    <ul>
        <li>
            <a href="#">推荐榜</a>
        </li>
    </ul>
</div>
<!-- 内容区域 -->
<div class="content">
    <div class="content1" id="filmRankList">
        <dl>
            <%--<dd>

                <div>
                    <i class="No1"></i>
                </div>
                <div class="img">
                    <a href="#">
                        <img src="${pageContext.request.contextPath}/front/style/IMG/Bangdan_2.jpg" alt="">
                    </a>
                </div>
                <div>
                    <div>
                        <a href="${pageContext.request.contextPath}/front/style/HTML/dianyingxiangqing.html" title="毒液：致命守护者">毒液：致命守护者</a>
                        <p>

                            主演：汤姆·哈迪,米歇尔·威廉姆斯,里兹·阿迈德

                        </p>
                        <p>上映时间：2018-11-09</p>
                    </div>
                    <div>
                        <i>9.</i>
                        <i>4</i>
                    </div>
                </div>
            </dd>--%>
        </dl>
    </div>
</div>
<!-- 喵 -->
<a class="miao" href="#" target="blank"></a>
<script src="${pageContext.request.contextPath}/front/style/JS/jquery-1.11.0.min.js"></script>
<script>
    $(document).ready(function () {
       $.ajax({
         async:true,
         type:"get",
         url:"${pageContext.request.contextPath}/front/filmRankList",
         dataType:"json",
         success:function (result) {
             $.each(result,function (index,filmRank) {
                 var content = "<dd>\n" +
                     "\n" +
                     "                <div>\n" +
                     "                    <i class=\"No1\"></i>\n" +
                     "                </div>\n" +
                     "                <div class=\"img\">\n" +
                     "                    <a href=\"#\">\n" +
                     "                        <img src=\"${pageContext.request.contextPath}/download/img?fileName="+filmRank.film.filmCover+"\" alt=\"\">\n" +
                     "                    </a>\n" +
                     "                </div>\n" +
                     "                <div>\n" +
                     "                    <div>\n" +
                     "                        <a href=\"${pageContext.request.contextPath}/front/movieDetail.jsp?filmId="+filmRank.film.filmId+"\" title=\""+filmRank.film.filmName+"\">"+filmRank.film.filmName+"</a>\n" +
                     "                        <p>上映时间："+filmRank.film.filmReleaseTime+"</p>\n" +
                     "                    </div>\n" +
                     "                    <div>\n" +
                     "                        <i></i>\n" +
                     "                        <i>推荐排行："+filmRank.rankNumber+"</i>\n" +
                     "                    </div>\n" +
                     "                </div>\n" +
                     "            </dd>";
                 $("#filmRankList dl").append(content);
             })

         },
           error:function () {
               alert("异步请求失败");
           }
       });
    });
</script>
</body>
<script type="text/javascript">
    // 判断是否登录
    var account = "${sessionScope.account}";
    if(account != ""){
        $(".denglu img").prop("src","${pageContext.request.contextPath}/download/img?fileName=${sessionScope.account.accountPicture}");
        $("#showStatus").text("退出登录");
        $("#showStatus").prop("src","#");
    }
    $(document).on("click","#showStatus",function(){
        if($(this).text()=="退出登录"){
            $.ajax({
                url:"${pageContext.request.contextPath}/front/logout",
                success:function(){
                    console.log("退出成功");
                },
                error:function(){
                    console.log("退出失败");
                }
            });
        }
    })

</script>
</html>
